local lazypath = vim.g.sd_vim_dir .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"https://github.com/folke/lazy.nvim.git",
		"--branch=stable", -- latest stable release
		lazypath,
	})
end
-- vim.opt.rtp:prepend(lazypath)
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)

-- local Util = require("util")
local opts = {
	root = vim.g.sd_vim_dir .. "/lazy/plugins",
	defaults = {
		lazy = true,
		version = nil,
		cond = nil,
	},
	-- spec = nil,
	spec = {
		-- add LazyVim and import its plugins
		-- { "LazyVim/LazyVim"},
		{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
    -- import any extras modules here
    -- { import = "lazyvim.plugins.extras.coding.blink" },
		-- { import = "lazyvim.plugins.extras.lang.typescript" },
		{ import = "lazyvim.plugins.extras.lang.json" },
		-- { import = "lazyvim.plugins.extras.ui.mini-animate" },
		-- { import = "lazyvim.plugins.extras.lsp.none-ls" },
		{ import = "lazyvim.plugins.extras.lang.go" },
		{ import = "lazyvim.plugins.extras.lang.yaml" },
		{ import = "lazyvim.plugins.extras.lang.ansible" },
		{ import = "lazyvim.plugins.extras.lang.docker" },
		{ import = "lazyvim.plugins.extras.lang.vue" },
		-- { import = "lazyvim.plugins.extras.editor.mini-files" },
		-- { import = "lazyvim.plugins.extras.coding.luasnip" },
		-- { import = "lazyvim.plugins.extras.editor.mini-diff" },
		{ import = "plugins" },
	},
	lockfile = vim.g.sd_vim_dir .. "/lazy-lock.json",
	concurrency = nil,
	git = {
		log = { "--since=3 days ago" },
		timeout = 120,
		filter = true,
	},
	dev = {
		path = "~/projects",
		patterns = {},
		fallback = false,
	},
	install = {
		missing = true,
		colorscheme = { "tokyonight", "habamax" },
	},
	checker = {
		enabled = false,
		concurrency = nil,
		notify = true,
		frequency = 3600,
	},
	change_detection = {
		enabled = true,
		notify = true,
	},
	performance = {
		cache = {
			enabled = true,
		},
		reset_packpath = true,
		rtp = {
			reset = true,
			paths = {},
			disabled_plugins = {
				"gzip",
				"matchit",
				"matchparen",
				"netrwPlugin",
				"tarPlugin",
				"tohtml",
				"tutor",
				"zipPlugin",
			},
		},
	},
	readme = {
		enabled = true,
		root = vim.g.sd_vim_dir .. "/lazy/readme",
		files = { "README.md", "lua//README.md" },

		skip_if_doc_exists = true,
	},
	state = vim.g.sd_vim_dir .. "/lazy/state.json",
}

require("lazy").setup(opts)
